*1. Import data
import delimited "pausellietal.csv", varnames(1)

*2. Format variables
tab treated
gen treated_dummy=1 if treated=="1"
replace treated_dummy=0 if treated_dummy==.
destring against, replace force
destring ideology_left , replace force
destring v2x_libdem, replace force
gen interaction = china_sup*treated_dummy
egen country_code=group(country_str )
egen title_code=group(title)
gen global_south=0 if country_code ==9 | country_code ==10  | country_code ==15 | country_code ==18| country_code ==21| country_code ==25| country_code ==30| country_code ==32| country_code ==34| country_code ==40| country_code ==43| country_code ==44| country_code ==47| country_code ==50| country_code ==51| country_code ==55| country_code ==56| country_code ==58| country_code ==64| country_code ==67| country_code ==70| country_code ==80| country_code ==85| country_code ==92| country_code ==93| country_code ==94| country_code ==95 | country_code == 101| country_code == 102| country_code == 105| country_code ==106 | country_code == 109 | country_code == 115| country_code == 116| country_code ==117
replace global_south =1 if global_south ==.
gen placebo_treated = treated_dummy
replace placebo_treated =0 if year ==2014
replace placebo_treated =1 if year ==2013
tab placebo_treated
tabstat treated_dummy , by(year)
tabstat treated_dummy placebo_treated  , by(year)
replace treated_dummy  =1 if year ==2008
replace treated_dummy  =1 if year ==2017
replace placebo_treated =1 if year==2008
replace placebo_treated =1 if year==2017
tabstat treated_dummy placebo_treated , by(year)
replace oda=oda/1000000
replace chinese_fdi = chinese_fdi/1000000
gen random=1 if random_resolutions =="Yes"
replace random=0 if random==.
destring treated_india , replace force
gen india_sup=1 if india_support =="Yes"
replace india_sup=0 if india_support =="No"


*Figure 2: Number of resolutions voted at UNHRC by year
preserve
keep treated against ideology_left v2x_libdem  country_str title against year random_resolutions treated_india india_support india_sup country_str china_sup country_target_filt oda_cn chinese_fdi agree_china resolution topic1 
egen res_code=group(resolution )
collapse (count) res_code   ,by(year)
graph bar res_code if year>=2006 & year<=2020, over(year)
 restore
